using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Qibla.Library;

namespace Qibla_Standalone
{
    public partial class frmQiblaStd : Form
    {
        public frmQiblaStd()
        {
            InitializeComponent();
        }


        private void mnuExit_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }

        QiblaLib _qiblaLib = new QiblaLib();

        private void mnuPlot_Click(object sender, EventArgs e)
        {
            PointD start = new PointD();
            PointD end = new PointD(); ;
            if (tbStart.Text != string.Empty && tbEnd.Text != string.Empty)
            {
                string[] coords = tbStart.Text.Split(new char[] { ',' });
                start = new PointD(double.Parse(coords[1]), double.Parse(coords[0]));
                coords = tbEnd.Text.Split(new char[] { ',' });
                end = new PointD(double.Parse(coords[1]), double.Parse(coords[0]));
            }
                        
            //Image img = _qiblaLib.DrawCompass(pbCompass.Height, pbCompass.Width, start, end);
            Image img = _qiblaLib.DrawCompass(pbCompass.Height, pbCompass.Width, float.Parse(tbHeading.Text), start);
            pbCompass.Image = img;
                
        }

        private void frmQiblaStd_Load(object sender, EventArgs e)
        {
            pbCompass.Image = _qiblaLib.GetBlankGrid(pbCompass.Height, pbCompass.Width);
        }

    }
}